package com.yunji.aggregate.model.vo.container;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.yunji.common.annotation.Excel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * @Package com.yunji.cabinet.vo
 * FileName:	ScanContainerVO.java
 * Copyright:	Copyright © 2024 云集互联 All Rights Reserved
 * Company:		云集互联
 * @version: 1.0
 * @since: JDK 1.8.0_202
 * Create at:   2024-04-12 17:00:45
 * Description:
 * 员工扫码货柜响应参数
 * Modification History:
 * Author					Date						Version			Description
 * --------------------------------------------------------------------------------
 * HuaAo				2024-04-12 17:00:45			1.0				1.0 Version
 */
@Data
public class CabinetStatisticsVO {
    @ApiModelProperty(value = "货柜ID")
    private Long containerId;

    @ApiModelProperty(value = "货柜名称", required = true)
    @Excel(name = "货柜名称")
    private String containerName;

    @ApiModelProperty(value = "芯片SN")
    @Excel(name = "芯片SN")
    private String chipSn;

    @ApiModelProperty(value = "芯片IMEI", required = true)
    @Excel(name = "chipImei")
    private String chipImei;

    @ApiModelProperty(value = "二维码Code")
    @Excel(name = "二维码Code")
    private String qrCode;

    @ApiModelProperty("货柜在线状态 (0=离线,1=在线)")
    @Excel(name = "货柜激活状态", readConverterExp = "0=离线,1=在线")
    private Integer onlineStatus;

    @ApiModelProperty("货柜在线时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    //@Excel(name = "货柜在线时间")
    private String onlineTime;

    @ApiModelProperty("货柜离线时间")
    @Excel(name = "货柜离线时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private String offlineTime;


    @ApiModelProperty("货柜使用状态 (0-启用:1-停用:2-未绑定)")
    //@Excel(name = "货柜使用状态", readConverterExp = "0-启用:1-停用:2-未绑定")
    private Integer useStatus;

    @ApiModelProperty("货柜激活时间")
    //@Excel(name = "货柜激活时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private String useTime;

    @ApiModelProperty("货柜类型CODE")
    private String typeCode;

    @ApiModelProperty("货柜类型名称")
    @Excel(name = "货柜类型名称")
    private String typeName;

    @ApiModelProperty("货柜储物格数")
    @Excel(name = "货柜储物格数")
    private Integer nums;

    @ApiModelProperty("模板ID")
    private Long templateId;

    @ApiModelProperty("模板名称")
    private String templateName;

    @ApiModelProperty("所属ID")
    private Long belongId;

    @ApiModelProperty("代理ID")
    private Long agentId;

    @ApiModelProperty("代理名称")
    @Excel(name = "代理名称")
    private String agentName;

    @ApiModelProperty("经理用户ID")
    //@Excel(name = "经理用户ID")
    private Long managerId;

    @ApiModelProperty("经理用户名称")
    //@Excel(name = "经理用户名称")
    private String managerName;

    @ApiModelProperty("绑定的员工ID")
    private Long staffId;

    @ApiModelProperty("绑定的员工名称")
    //@Excel(name = "绑定的员工名称")
    private String staffName;

    @ApiModelProperty("绑定时间")
    //@Excel(name = "绑定时间")
    private Date bindTime;

    @ApiModelProperty("省份名称")
    @Excel(name = "省份名称", width = 15)
    private String provinceName;

    @ApiModelProperty("省份代码")
    private String provinceCode;

    @ApiModelProperty("城市名称")
    @Excel(name = "城市名称", width = 15)
    private String cityName;

    @ApiModelProperty("城市代码")
    private String cityCode;

    @ApiModelProperty("区县名称")
    @Excel(name = "区县名称", width = 15)
    private String countyName;

    @ApiModelProperty("区县代码")
    private String countyCode;

    @ApiModelProperty("货柜地址")
    @Excel(name = "货柜地址")
    private String region;

    @ApiModelProperty("货柜详细地址")
    @Excel(name = "货柜详细地址")
    private String address;

    @ApiModelProperty("删除状态 (0-未删除 1-已删除)")
    //@Excel(name = "删除状态", readConverterExp = "0-未删除 1-已删除")
    private Integer delFlag;

    @ApiModelProperty("网点ID")
    private Long siteId;

    @ApiModelProperty("网点名称")
    @Excel(name = "网点名称")
    private String siteName;

    @ApiModelProperty("空柜格子")
    private Integer emptyContainerNums;

    @ApiModelProperty("电量值")
    private Integer battleLevel;

    @ApiModelProperty("电量状态")
    private Integer battleLevelStatus;

    public Integer getBattleLevelStatus() {
        if (battleLevel == null) return 0;
        return battleLevel <=20 ? 0 : 1 ;
    }

    @ApiModelProperty("休眠状态 0-休眠 1-正常")
    private Integer sleepStatus;

    @ApiModelProperty("点位ID")
    private Long locationId;

    @ApiModelProperty("点位名称")
    private String locationName;

    @ApiModelProperty("点位类型名称")
    private String locationTypeName;

    @ApiModelProperty("商品数量")
    private Integer productQuantity;

    @ApiModelProperty("容量上限")
    private Integer ceilingQuantity;

    public Integer getProductQuantity() {
        int a = 0;
        if (cells != null) {
            for (CabinetCellStatisticsVO cell : cells) {
                a += cell.getProductQuantity();
            }
        }
        return a;
    }

    public Integer getCeilingQuantity() {
        int a = 0;
        if (cells != null) {
            for (CabinetCellStatisticsVO cell : cells) {
                a += cell.getCeilingQuantity();
            }
        }
        return a;
    }

    @ApiModelProperty("红外距离")
    private Integer distance;

    @ApiModelProperty("信号")
    private Integer rssi;

    @ApiModelProperty("红外状态 1-异常 0-正常")
    private Integer infraredStatus;

    @ApiModelProperty("检测数量")
    private Integer identityQuantity;

    @ApiModelProperty("运行状态 0-异常 1-正常")
    private Integer runtimeStatus;

    @ApiModelProperty("运行错误")
    private String runtimeError;

    /*-------------------------------------------------------------------------------查询信息---------------------------------------------------------------------------------------*/
    //员工电话
    @ApiModelProperty("员工电话")
    private String staffTel;

    // 销售金额
    @ApiModelProperty("销售金额")
    private BigDecimal totalAmount;
    // 销售次数
    @ApiModelProperty("销售次数")
    private Integer totalCount;

    private List<CabinetCellStatisticsVO> cells;

    private Long[] shapeIds;

    private Long[] typeIds;

    @ApiModelProperty("创建人ID")
    private Long creator;

    /**
     * 创建人名称
     */
    @Excel(name = "创建人名称")
    @ApiModelProperty("创建人名称")
    private String createName;

    /**
     * 创建时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Excel(name = "创建时间", dateFormat = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty("创建时间")
    private Date createTime;

    @ApiModelProperty("芯片类型")
    private String chipType;
    @ApiModelProperty("软件版本")
    private String version;

    @ApiModelProperty("异常状态")
    private String abnormalStatus;

}